﻿using System;
using System.Collections.Generic;

using RexToy.UI.WinForm;
using RexToy.UI.WinForm.Controls;

namespace UnitTest.WinForm.SampleControl
{
    public class TestForm : Form
    {
        [PmlxBoundControl]
        protected DataComboBox cmbPerson;

        [PmlxBoundControl]
        protected DetailListView lvPerson;

        [PmlxBoundControl("btnOK")]
        protected System.Windows.Forms.Button btnSubmit;

        protected override void OnLoad(EventArgs e)
        {
            var list = new[] {
                new { Name = "A", Gender = true , Birthday=DateTime.Parse("2000-1-1")},
                new { Name = "B", Gender = false, Birthday = DateTime.Parse("2003-5-5") }
            };

            cmbPerson.Bind(list);
            lvPerson.Bind(list);

            btnSubmit.Click += new EventHandler(btnSubmit_Click);
        }

        void btnSubmit_Click(object sender, EventArgs e)
        {
            int i = cmbPerson.SelectedIndex;
        }
    }
}
